cmake_minimum_required(VERSION 3.8)

project(visual-calculator-toolkit VERSION 0.0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_SHARED_MODULE_PREFIX "")
set(CMAKE_SHARED_MODULE_SUFFIX ".panel-plugin")

find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

find_library(${PROJECT_NAME} visual-calculator)

add_library(${PROJECT_NAME} MODULE
    src/PanelAdaptor.cpp
    src/PanelAdaptor.h
    src/ToolkitPlugin.cpp
    src/ToolkitPlugin.h
    src/ToolkitWidget.cpp
    src/ToolkitWidget.h
    res/toolkit-panel.qrc
)

target_link_libraries(${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Widgets)

target_link_libraries(${PROJECT_NAME} visual-calculator)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/src/include)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/plugins)
